home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7931 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  43 lines

  1. Path: news.informatik.uni-muenchen.de!usenet
  2. From: watzka <watzka@stat.uni-muenchen.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What is &Variable (declared as: char Variable[10])?
  5. Date: Tue, 27 Feb 1996 17:54:00 +0100
  6. Organization: Institut fⁿr Statistik
  7. Message-ID: <31333728.1F2E@stat.uni-muenchen.de>
  8. NNTP-Posting-Host: pc9.stat.uni-muenchen.de
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (WinNT; I)
  13.  
  14. Brenda wrote:
  15. > schlein@umbc.edu (Jonas J. Schlein) wrote:
  16. > >Abu Wawda <wawda@alcor.usc.edu> wrote:
  17. > >|> I'm having trouble understanding what the address of a static array
  18. > >|> is.
  19. > >
  20. > >I'm having trouble understanding why it matters? You almost never use the
  21. > >address of an array directly unless doing something tricky with pointers
  22. > >or with particular dimensions of a multiple dimensional array.
  23. > >
  24. > >|> For example, if I declare a variable called myarray as:
  25. > >|>     char myarray[10];
  26. > >|> then what could &myarray possibly mean? myarray is not a pointer, so
  27. > >|> &myarray could not possibly be the address of the variable myarray
  28. > >|> (like it would be if I did char* myarray and then asked for &myarray).
  29. > >
  30. > >Yes it could and yes it is...'myarray' is not a pointer, but &myarray is
  31. > >a pointer to 'myarray'.
  32. > Um, that's not correct.  myarray is DEFINITELY a pointer!  As declared above,
  33. > it is a constant pointer to 10 contiguous char datatypes.
  34.  
  35. "myarray" is _not_ a pointer, it is an array of 10 char. If you want to 
  36. learn more about the difference (and similarities in expressions, where
  37. arrays _decay_ to pointers to the first array element) between arrays
  38. and pointers, see the very informative FAQ for this newsgroup.
  39.  
  40. Kurt
  41.